/**
 * 条件为:存在长度至少为2的回文子串
 * 偶数长度的回文串必然为 ...xyzzyx...
 * 奇数长度的回文串必然为 ...xyzAzyx...
 * 所以只需要观察长度为3的串即可，
 * 即当前位与前两位之一要相等
 */
#include <bits/stdc++.h>
using namespace std;

using llt = long long;
llt const MOD = 1E9 + 7;
// Dijk, j表示前两位, k表示has
// 必须要有第三维
llt D[1100][100][2]; 
vector<int> G;
int const FULL = 10;

// single用来标记是否刚好是一个数
// has标记是否找到了
llt dfs(int pos, int pre, int has, bool lead, bool limit, bool single){
    if(-1 == pos){ 
        return has;
    }
    if(not lead and not limit and not single and -1 != D[pos][pre][has]){
        return D[pos][pre][has];
    }

    int last = limit ? G[pos] : FULL - 1;
    llt ans = 0;
    for(int i=0;i<=last;++i){
        if(0 == i and lead){
            ans += dfs(pos - 1, pre, 0, true, limit&&last==i, false);
        }else if(lead){
            ans += dfs(pos - 1, i, 0, false, limit&&last==i, true);
        }else{
            int nHas = 0;
            if(pre % 10 == i) nHas = 1;
            if(not single and pre / 10 == i) nHas = 1;
            ans += dfs(pos - 1, pre%10*10+i, nHas | has, false, limit&&last==i, false);
        }
        ans %= MOD;
    }

    if(not lead and not limit and not single){
        D[pos][pre][has] = ans;
    }
    return ans;
}

llt digitDP(const string & s){
    G.clear();
    for(auto c : s) G.emplace_back(c - '0');
    reverse(G.begin(), G.end());
    auto ans = dfs(G.size() - 1, 0, 0, true, true, false);
    return ans;
}

string A, B;
void work(){
    cin >> A >> B;
    // A减减
    int k = A.length() - 1;
    while(k >= 0 and A[k] == '0') k -= 1;
    assert(k >= 0);
    A[k] -= 1;
    for(int i=k+1;i<A.length();++i) A[i] = '9';
    auto a = digitDP(A);
    auto b = digitDP(B);
    cout << ((b - a) % MOD + MOD) % MOD << endl;
    return;
}

int main(){
#ifndef ONLINE_JUDGE
    freopen("z.txt", "r", stdin);
#endif
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);	
    memset(D, -1, sizeof(D));
    int nofkase = 1;
    // cin >> nofkase;
    while(nofkase--) work();
	return 0;
}